<%@ page import="ar.com.hakasoft.utils.NumberUtil" %>

<html>
<head>
<meta name="layout" content="mainApp" />
<g:javascript library="jquery"  /> 
<g:javascript library="facturacion" />
</head>
<body>
    <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${facturaInstance}">
    <div class="errors">
        <g:renderErrors bean="${facturaInstance}" as="list" />
    </div>
	</g:hasErrors>
	    <g:hasErrors bean="${facturaInstance}">
    <div class="errors">
        <g:renderErrors bean="${facturaInstance}" as="list" />
    </div>
	</g:hasErrors>
 	<g:uploadForm action="show" name="form" controller="facturacion" >
 	
 		<g:hiddenField name="id" value="${facturaInstance.id}" />
 		
	    <div class="dialog" align="center">
	        <table>
	            <tbody>
	           		<tr class="prop">
	                    <td valign="top" class="name">
	                        <label>N&uacute;mero de factura</label>
	                    </td>
  	                    <td valign="top" class="value">
	        				<label><b>${facturaInstance.id}</b></label>
                        </td>
	                </tr>
	            	<g:if test="${ facturaInstance?.vendedor?.nombre }">
		                <tr class="prop">
		                    <td valign="top" class="name">
		                        <label for="vendedor">Vendedor</label>
		                    </td>
	  	                    <td valign="top" class="value">
		        				<label><b>${facturaInstance?.vendedor?.nombre}</b></label>
	                        </td>
		                </tr>
	            	</g:if>
	            	<g:if test="${ facturaInstance?.dietetica?.nombre }">
		                <tr class="prop">
		                    <td valign="top" class="name">
		                        <label>Diet&eacute;tica</label>
		                    </td>
	  	                    <td valign="top" class="value">
		        				<label><b>${facturaInstance?.dietetica?.nombre}</b></label>
	                        </td>
		                </tr>
	  	                <tr class="prop">
		                    <td valign="top" class="name">
		                        <label>Direcci&oacute;n</label>
		                    </td>
	  	                    <td valign="top" class="value">
		        				<label><b>${facturaInstance?.dietetica?.direccion}</b></label>
	                        </td>
		                </tr>
	  	                <tr class="prop">
		                    <td valign="top" class="name">
		                        <label>Tel&eacute;fono</label>
		                    </td>
	  	                    <td valign="top" class="value">
		        				<label><b>${facturaInstance?.dietetica?.telefono}</b></label>
	                        </td>
		                </tr>
	                </g:if>
	               	<g:if test="${ facturaInstance?.cliente?.nombre }">
		                <tr class="prop">
		                    <td valign="top" class="name">
		                        <label for="cliente">Cliente</label>
		                    </td>
	  	                    <td valign="top" class="value">
		        				<label><b>${facturaInstance?.cliente?.nombre}</b></label>
	                        </td>
		                </tr>
	            	</g:if>
  	                <tr class="prop">
	                    <td valign="top" class="name">
	                        <label>Fecha</label>
	                    </td>
  	                    <td valign="top" class="value">
	        				<label><b><g:formatDate format="dd/MM/yyyy" date="${facturaInstance?.fecha}"/> </b></label>
                        </td>
	                </tr>
	                <tr class="prop">
	                    <td valign="top" class="name">
	                        <label>Fue Cobrada</label>
	                    </td>
  	                    <td valign="top" class="value">
	        				<label><b>${facturaInstance?.fueCobrada ? 'SI' : 'NO'}</b></label>
                        </td>
	                </tr>
	            
	            </tbody>
	        </table>
	    </div>
	    
	    <br><br>
	    <g:render template="/templates/tablaItems" model="['listadoItems':facturaInstance?.itemFactura, 'edit':false, mapaTotales:mapaTotales]"></g:render>
		<br><br>
		<div align="center">
		    <button class="imprimir" onclick="window.open('${ g.createLink(action: 'imprimir', id: facturaInstance.id ) }', 'Imprimir','status=1,toolbar=1');" name="Imprimir" value="Imprimir" action="imprimir" >Imprimir</button>
		    <g:actionSubmit name="Editar" value="Editar" action="editar"  />
	    </div>
    
    	</g:uploadForm>
	    


</body>
</html>